<#--
	@Private
	a button with drop down menu, refer to jdate.ftl
-->
<#macro menubutton2 width=0 selectIndex=5>
	<#-- TODO: Refactoring the following code, HARDCODE the default selection for jpageinfo.ftl -->
	<#if _gridModel?? && _gridModel==5>
		<#local selectIndex=0>
	</#if>
	
	<#assign id = 'menubutton' + fn.id>
	<span id='${id}' class="jmenubutton button" onclick="showButtonMenu2(event, this)"  
		style="height: 21px;padding: 0 3px;border-radius:0;<#if width gt 0>width:${width}px;</#if>">
		<span class="button-caption">
		</span>
		<span class="buttonMenu">
			<#nested>
		</span>
	</span>
	<script>
		$(document).ready(function(){
			selectButtonMenu2($('#${id}'), ${selectIndex});
		});
	</script>
</#macro>


<#--
	@Private
	a button with drop down menu and down-arrow icon
-->
<#macro menubutton width=0>
	<span class="jmenubutton" style="float: left;height: 21px;padding:0;margin-left:0;<#if width gt 0>width:${width}px;</#if>">
		<span class="button-caption">
			<span class="blankButton"></span>
		</span>
		<span class="button-more" onclick="showButtonMenu(event, this)"><em>
		</em></span>
		<span class="buttonMenu">
			<#nested>
		</span>
	</span>
</#macro>

<#--
	@Private
	@Deprecated
-->
<#macro ebutton label='' name='' onclick='' clazz='' style='' url='' method='' submit='' params='' target='' showMoreIcon=false positionCol=-1>
	<#if target != ''> 
		<#if submit == 'Y' || submit == 'true'>
			<#assign jsFunction = 'submitPage(this,'>
			<#assign params = params + '&skipForm=true'>
		<#else>
			<#assign jsFunction = "openLink(">
		</#if>
		<#assign jsFunction = jsFunction + "buildRequest(this,'" + method + "','" + fn.link(url) + "','" + params + "'),'" + target + "','" + label + "')">
	<#else>
		<#assign jsFunction = method + "Record(this,'" + fn.link(url) + "')">
	</#if>
	
	<#if url == '' && method != '' && actionPath??>
		<#local url = '/' + fn.replaceAction(actionPath, method) + '.' + fn.getActionExtension()>
	</#if>
	
	<@button label=label name=name onclick=jsFunction clazz=clazz style=style url=url showMoreIcon=showMoreIcon positionCol=positionCol/>
</#macro>

<#--
	@Private
-->
<#macro fontselector name='' value=''>
<@css src="/static/espirit/styles/fontselector.css"/>
<@script src="/static/espirit/scripts/jquery.fontselector.js"/>

<#assign id = 'fontSelect' + fn.id>
<#if value?is_string && value==''>
	<#assign val=_getValue(name)>
<#else>
	<#assign val=value>
</#if>

<div id="${id}" class="fontSelect">
	<span style="${val}">Arial</span>
	<div class="arrow-down"></div>
	
	<ul>
		<div class="fontStyle">
			<a class="style" href="#" title="Bold">Bold</a> |
			<a class="style" href="#" title="Italic">Italic</a> |
			<a class="style" href="#" title="Underline">Underline</a>
			
			<select>
				<option value="10">10</option>
				<option value="12">12</option>
				<option value="16">16</option>
				<option value="18">18</option>
				<option value="20">20</option>
				<option value="24">24</option>
				<option value="26">26</option>
				<option value="28">28</option>
				<option value="36">36</option>
				<option value="48">48</option>
			</select>
		</div>
		<li>Arial,Arial,Helvetica,sans-serif</li>
		<li>Arial Black,Arial Black,Gadget,sans-serif</li>
		<li>Comic Sans MS,Comic Sans MS,cursive</li>
		<li>Courier New,Courier New,Courier,monospace</li>
		<li>Georgia,Georgia,serif</li>
		<li>Impact,Charcoal,sans-serif</li>
		<li>Lucida Console,Monaco,monospace</li>
		<li>Lucida Sans Unicode,Lucida Grande,sans-serif</li>
		<li>Palatino Linotype,Book Antiqua,Palatino,serif</li>
		<li>Tahoma,Geneva,sans-serif</li>
		<li>Times New Roman,Times,serif</li>
		<li>Trebuchet MS,Helvetica,sans-serif</li>
		<li>Verdana,Geneva,sans-serif</li>
		<li>Gill Sans,Geneva,sans-serif</li>
	</ul>
	
	<input type="hidden" name="${name}" value="${val}"/>
</div>

<script type="text/javascript">
	$(function() {
		$('#${id}').fontSelector({
			'hide_fallbacks' : true,
			'initial' : 'Courier New,Courier New,Courier,monospace',
			'selected': function(font) {
				var $root = $('#${id}');
				var style = $root.children('span').attr('style');
				$root.children('input').val(style).triggerHandler('change');
			}
		});
	});
</script>
</#macro>